#!/bin/bash

logPath=
array_services=
yesterday=`date -d yesterday +%Y-%m-%d_000`
today=`date +%Y-%m-%d%_000`
hour=`date +%H`
hour=`expr ${hour}`

for s in ${array_services[@]};
do
    echo ${s}
    for ((i=${hour}; i<=23; i++))
    do
        format_num=`printf "%.2d\n" ${i}`
        log_file_name=${logPath}'/'${s}/${s}'-'${yesterday}${format_num}
        grep '\[ERROR' ${log_file_name}
    done
    for ((i=0; i<=${hour}; i++))
    do
        format_num=`printf "%.2d\n" ${i}`
        log_file_name=${logPath}'/'${s}/${s}'-'${today}${format_num}
        grep '\[ERROR' ${log_file_name}
    done
done